package com.sitech.ibnms.util;



/**
 * 
* <p>Title: AppException.java</p>
* <p>Description:系统异常基类</p>
* <p>Copyright: Copyright (c) SITECH 2011</p>
* @author LJ
* @date Sep 27, 2011 2:33:53 PM
* @version V6.0
 */
public class AppException extends Exception {
	
	public static final String NO_RIGHTS_TO_ACCESS="no.rights.to.access";
	private static final long serialVersionUID = 1L;
	private int errorCode;
	private Exception exception;
	
	private String message;
	private String errorTittle="";
	private String errorDesc="";
	private String errorName="";

	
	public int getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}


	public AppException(String errorName, Exception exception) {
		super(exception);
		this.exception = exception;
		if(exception instanceof ServiceException)
		{
			ServiceException se=(ServiceException)exception;
			this.errorDesc=se.getErrorDesc();
		}
		this.errorName = errorName;
		if(this.errorDesc!=null && !this.errorDesc.equals(""))
		  this.errorTittle=this.errorName+":"+this.errorDesc;
		else
		  this.errorTittle=this.errorName;
	}

	public AppException(String errorName,String errorDesc, Exception exception) {
		super(exception);		
		this.exception = exception;		
		this.errorName = errorName;
		if(errorDesc!=null && !errorDesc.equals(""))
		  this.errorTittle=this.errorName+":"+errorDesc;
		else
		  this.errorTittle=this.errorName;
	}
	public AppException(int errorCode, Exception exception) {
		super(exception);
		this.exception = exception;
		this.errorCode = errorCode;
	}
    

	
	
	public String getErrorDesc() {
		return errorDesc;
	}

	public void setErrorDesc(String errorDesc) {
		this.errorDesc = errorDesc;
	}

	public String getErrorTittle() {		
		return errorTittle;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	

	public String getErrorName() {
		return errorName;
	}

	public void setErrorName(String errorName) {
		this.errorName = errorName;
	}

	public static void main(String[] a) {
		//AppException ex = new AppException(111, "ddd");
		
	}

}
